<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>AdWords::Service</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
    <link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
    <script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
    <script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
</head>

<body>     
    <div class="banner">
        <h1>
            <span class="type">Module</span> 
            AdWords::Service 
            
        </h1>
        <ul class="files">
            
            <li><a href="../../files/lib/adwords4r/services_rb.html">lib/adwords4r/services.rb</a></li>
            
        </ul>
    </div>
    <div id="bodyContent">
        <div id="content">
    
    <div class="description">
        <p>
Contains helper methods for loading and managing the available services.
</p>

    </div>
    

    

    
    

    
    
    <div class="sectiontitle">Methods</div>
    <dl class="methods">
    
        <dt>A</dt>
        <dd>
            <ul>
                
                <li><a href="#M000068">add_environment</a></li>
                
            </ul>
        </dd>
    
        <dt>D</dt>
        <dd>
            <ul>
                
                <li><a href="#M000069">do_require</a></li>
                
            </ul>
        </dd>
    
        <dt>E</dt>
        <dd>
            <ul>
                
                <li><a href="#M000052">environment_has_version</a></li>
                
            </ul>
        </dd>
    
        <dt>G</dt>
        <dd>
            <ul>
                
                <li><a href="#M000066">get_auth_server</a>,</li>
                
                <li><a href="#M000060">get_default_environment</a>,</li>
                
                <li><a href="#M000056">get_default_version</a>,</li>
                
                <li><a href="#M000061">get_endpoint</a>,</li>
                
                <li><a href="#M000059">get_environments</a>,</li>
                
                <li><a href="#M000071">get_interface_name</a>,</li>
                
                <li><a href="#M000051">get_latest_version</a>,</li>
                
                <li><a href="#M000070">get_module_name</a>,</li>
                
                <li><a href="#M000073">get_namespace_v2009</a>,</li>
                
                <li><a href="#M000063">get_report_download_url</a>,</li>
                
                <li><a href="#M000058">get_services</a>,</li>
                
                <li><a href="#M000064">get_subdir</a>,</li>
                
                <li><a href="#M000050">get_versions</a>,</li>
                
                <li><a href="#M000072">get_wrapper_name</a></li>
                
            </ul>
        </dd>
    
        <dt>V</dt>
        <dd>
            <ul>
                
                <li><a href="#M000074">validate_param</a>,</li>
                
                <li><a href="#M000055">version_has_service</a></li>
                
            </ul>
        </dd>
    
    </dl>
    

    

    

    

    
    <div class="sectiontitle">Constants</div>
    <table border='0' cellpadding='5'>
        
        <tr valign='top'>
            <td class="attr-name">DEFAULT_VERSION</td>
            <td>=</td>
            <td class="attr-value">201008</td>
        </tr>
        
        <tr valign='top'>
            <td>&nbsp;</td>
            <td colspan="2" class="attr-desc"><p>
Set defaults
</p>
</td>
        </tr>
        
        
        <tr valign='top'>
            <td class="attr-name">DEFAULT_ENVIRONMENT</td>
            <td>=</td>
            <td class="attr-value">'PRODUCTION'</td>
        </tr>
        
        
    </table>
    

    

    
            <div class="sectiontitle">Class Public methods</div>
            
            <div class="method">
                <div class="title" id="M000068">
                    
                    <a name="M000068"></a><b>add_environment</b>(name, endpoint_hash)
                    
                </div>
                
                <div class="description">
                  <p>
Add a new environment to the list.
</p>
<p>
Args:
</p>
<ul>
<li>name: the name for the new environment

</li>
<li>endpoint_hash: a hash of base endpoint URLs, indexed by version number,
e.g.:

<pre>
 { 13 =&gt; 'URL_FOR_v13', 200906 =&gt; 'URL_FOR_v200906' }
</pre>
</li>
</ul>

                </div>
                
                
                
                
                <div class="sourcecode">
                    <p class="source-link">
                        Source: <a href="javascript:toggleSource('M000068_source')" id="l_M000068_source">show</a>
                        
                    </p>
                    <div id="M000068_source" class="dyn-source">
                        <pre><span class="ruby-comment cmt"># File lib/adwords4r/services.rb, line 296</span>
    <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">add_environment</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">endpoint_hash</span>)
      <span class="ruby-ivar">@@environments</span>[<span class="ruby-identifier">name</span>] = <span class="ruby-identifier">endpoint_hash</span>
    <span class="ruby-keyword kw">end</span></pre>
                    </div>
                </div>
                
            </div>
            
            <div class="method">
                <div class="title" id="M000069">
                    
                    <a name="M000069"></a><b>do_require</b>(version)
                    
                </div>
                
                <div class="description">
                  <p>
Perform the loading of the necessary source files for a version
</p>
<p>
Args:
</p>
<ul>
<li>version: the <a href="API.html">API</a> version (as an integer)

</li>
</ul>

                </div>
                
                
                
                
                <div class="sourcecode">
                    <p class="source-link">
                        Source: <a href="javascript:toggleSource('M000069_source')" id="l_M000069_source">show</a>
                        
                    </p>
                    <div id="M000069_source" class="dyn-source">
                        <pre><span class="ruby-comment cmt"># File lib/adwords4r/services.rb, line 305</span>
    <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">do_require</span>(<span class="ruby-identifier">version</span>)
      <span class="ruby-identifier">get_services</span>(<span class="ruby-identifier">version</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">service</span><span class="ruby-operator">|</span>
        <span class="ruby-identifier">eval</span>(<span class="ruby-node">&quot;require 'adwords4r/v#{version}/#{service}ServiceWrapper.rb'&quot;</span>)
      <span class="ruby-keyword kw">end</span>
    <span class="ruby-keyword kw">end</span></pre>
                    </div>
                </div>
                
            </div>
            
            <div class="method">
                <div class="title" id="M000052">
                    
                    <a name="M000052"></a><b>environment_has_version</b>(environment, version)
                    
                </div>
                
                <div class="description">
                  <p>
Does the given environment exist and contain the given version?
</p>
<p>
Returns: Boolean indicating whether the given environment exists and
contains the given version
</p>

                </div>
                
                
                
                
                <div class="sourcecode">
                    <p class="source-link">
                        Source: <a href="javascript:toggleSource('M000052_source')" id="l_M000052_source">show</a>
                        
                    </p>
                    <div id="M000052_source" class="dyn-source">
                        <pre><span class="ruby-comment cmt"># File lib/adwords4r/services.rb, line 166</span>
    <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">environment_has_version</span>(<span class="ruby-identifier">environment</span>, <span class="ruby-identifier">version</span>)
      <span class="ruby-keyword kw">return</span> (<span class="ruby-operator">!</span><span class="ruby-ivar">@@environments</span>[<span class="ruby-identifier">environment</span>].<span class="ruby-identifier">nil?</span> <span class="ruby-keyword kw">and</span>
              <span class="ruby-operator">!</span><span class="ruby-ivar">@@environments</span>[<span class="ruby-identifier">environment</span>][<span class="ruby-identifier">version</span>].<span class="ruby-identifier">nil?</span>)
    <span class="ruby-keyword kw">end</span></pre>
                    </div>
                </div>
                
            </div>
            
            <div class="method">
                <div class="title" id="M000066">
                    
                    <a name="M000066"></a><b>get_auth_server</b>(environment)
                    
                </div>
                
                <div class="description">
                  <p>
Get the authentication server details for an environment
</p>
<p>
Args:
</p>
<ul>
<li>environment: the service environment to be used (as a string)

</li>
</ul>
<p>
Returns: Array containing
</p>
<ul>
<li>the hostname for the auth server (as a string)

</li>
<li>the port for the auth server (as an integer)

</li>
<li>whether to use SSL or not (as a boolean)

</li>
</ul>

                </div>
                
                
                
                
                <div class="sourcecode">
                    <p class="source-link">
                        Source: <a href="javascript:toggleSource('M000066_source')" id="l_M000066_source">show</a>
                        
                    </p>
                    <div id="M000066_source" class="dyn-source">
                        <pre><span class="ruby-comment cmt"># File lib/adwords4r/services.rb, line 278</span>
    <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get_auth_server</span>(<span class="ruby-identifier">environment</span>)
      <span class="ruby-comment cmt"># If we don't have an entry for this environment, we just return the</span>
      <span class="ruby-comment cmt"># default server (the same one being used for the default environment)</span>
      <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@@auth_servers</span>[<span class="ruby-identifier">environment</span>].<span class="ruby-identifier">nil?</span>
        <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@@auth_servers</span>[<span class="ruby-constant">DEFAULT_ENVIRONMENT</span>]
      <span class="ruby-keyword kw">end</span>

      <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@@auth_servers</span>[<span class="ruby-identifier">environment</span>]
    <span class="ruby-keyword kw">end</span></pre>
                    </div>
                </div>
                
            </div>
            
            <div class="method">
                <div class="title" id="M000060">
                    
                    <a name="M000060"></a><b>get_default_environment</b>()
                    
                </div>
                
                <div class="description">
                  <p>
Get the default environment.
</p>
<p>
Returns: Default environment (as a string)
</p>

                </div>
                
                
                
                
                <div class="sourcecode">
                    <p class="source-link">
                        Source: <a href="javascript:toggleSource('M000060_source')" id="l_M000060_source">show</a>
                        
                    </p>
                    <div id="M000060_source" class="dyn-source">
                        <pre><span class="ruby-comment cmt"># File lib/adwords4r/services.rb, line 217</span>
    <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get_default_environment</span>
      <span class="ruby-keyword kw">return</span> <span class="ruby-constant">DEFAULT_ENVIRONMENT</span>
    <span class="ruby-keyword kw">end</span></pre>
                    </div>
                </div>
                
            </div>
            
            <div class="method">
                <div class="title" id="M000056">
                    
                    <a name="M000056"></a><b>get_default_version</b>()
                    
                </div>
                
                <div class="description">
                  <p>
Get the default <a href="API.html">API</a> version.
</p>
<p>
Returns: Default version (as an integer)
</p>

                </div>
                
                
                
                
                <div class="sourcecode">
                    <p class="source-link">
                        Source: <a href="javascript:toggleSource('M000056_source')" id="l_M000056_source">show</a>
                        
                    </p>
                    <div id="M000056_source" class="dyn-source">
                        <pre><span class="ruby-comment cmt"># File lib/adwords4r/services.rb, line 187</span>
    <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get_default_version</span>
      <span class="ruby-keyword kw">return</span> <span class="ruby-constant">DEFAULT_VERSION</span>
    <span class="ruby-keyword kw">end</span></pre>
                    </div>
                </div>
                
            </div>
            
            <div class="method">
                <div class="title" id="M000061">
                    
                    <a name="M000061"></a><b>get_endpoint</b>(environment, version, service)
                    
                </div>
                
                <div class="description">
                  <p>
Get the endpoint for a service on a given environment and <a
href="API.html">API</a> version.
</p>
<p>
Args:
</p>
<ul>
<li>environment: the service environment to be used (as a string)

</li>
<li>version: the <a href="API.html">API</a> version (as an integer)

</li>
<li>service: the name of the <a href="API.html">API</a> service (as a string)

</li>
</ul>
<p>
Returns: The endpoint URL (as a string)
</p>

                </div>
                
                
                
                
                <div class="sourcecode">
                    <p class="source-link">
                        Source: <a href="javascript:toggleSource('M000061_source')" id="l_M000061_source">show</a>
                        
                    </p>
                    <div id="M000061_source" class="dyn-source">
                        <pre><span class="ruby-comment cmt"># File lib/adwords4r/services.rb, line 231</span>
    <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get_endpoint</span>(<span class="ruby-identifier">environment</span>, <span class="ruby-identifier">version</span>, <span class="ruby-identifier">service</span>)
      <span class="ruby-identifier">base</span> = <span class="ruby-ivar">@@environments</span>[<span class="ruby-identifier">environment</span>][<span class="ruby-identifier">version</span>]
      <span class="ruby-identifier">path</span> = <span class="ruby-ivar">@@subdirs</span>[[<span class="ruby-identifier">version</span>, <span class="ruby-identifier">service</span>]]
      <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">base</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">base</span>
      <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
    <span class="ruby-keyword kw">end</span></pre>
                    </div>
                </div>
                
            </div>
            
            <div class="method">
                <div class="title" id="M000059">
                    
                    <a name="M000059"></a><b>get_environments</b>()
                    
                </div>
                
                <div class="description">
                  <p>
Get the available environments.
</p>
<p>
Returns: List of available environments (as strings)
</p>

                </div>
                
                
                
                
                <div class="sourcecode">
                    <p class="source-link">
                        Source: <a href="javascript:toggleSource('M000059_source')" id="l_M000059_source">show</a>
                        
                    </p>
                    <div id="M000059_source" class="dyn-source">
                        <pre><span class="ruby-comment cmt"># File lib/adwords4r/services.rb, line 208</span>
    <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get_environments</span>
      <span class="ruby-ivar">@@environments</span>.<span class="ruby-identifier">keys</span>
    <span class="ruby-keyword kw">end</span></pre>
                    </div>
                </div>
                
            </div>
            
            <div class="method">
                <div class="title" id="M000071">
                    
                    <a name="M000071"></a><b>get_interface_name</b>(version, service)
                    
                </div>
                
                <div class="description">
                  <p>
Returns the full interface class name for a given service
</p>
<p>
Args:
</p>
<ul>
<li>version: the <a href="API.html">API</a> version (as an integer)

</li>
<li>service: the service name (as a string)

</li>
</ul>
<p>
Returns: The full interface class name for the given service (as a string)
</p>

                </div>
                
                
                
                
                <div class="sourcecode">
                    <p class="source-link">
                        Source: <a href="javascript:toggleSource('M000071_source')" id="l_M000071_source">show</a>
                        
                    </p>
                    <div id="M000071_source" class="dyn-source">
                        <pre><span class="ruby-comment cmt"># File lib/adwords4r/services.rb, line 333</span>
    <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get_interface_name</span>(<span class="ruby-identifier">version</span>, <span class="ruby-identifier">service</span>)
      <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">version</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Integer</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">version</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-value">13</span>
        <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">get_module_name</span>(<span class="ruby-identifier">version</span>, <span class="ruby-identifier">service</span>) <span class="ruby-operator">+</span> <span class="ruby-node">&quot;::#{service}Interface&quot;</span>
      <span class="ruby-keyword kw">else</span>
        <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">get_module_name</span>(<span class="ruby-identifier">version</span>, <span class="ruby-identifier">service</span>) <span class="ruby-operator">+</span>
            <span class="ruby-node">&quot;::#{service}ServiceInterface&quot;</span>
      <span class="ruby-keyword kw">end</span>
    <span class="ruby-keyword kw">end</span></pre>
                    </div>
                </div>
                
            </div>
            
            <div class="method">
                <div class="title" id="M000051">
                    
                    <a name="M000051"></a><b>get_latest_version</b>()
                    
                </div>
                
                <div class="description">
                  <p>
Get the latest <a href="API.html">API</a> version.
</p>
<p>
Returns: Latest version (as an integer)
</p>

                </div>
                
                
                
                
                <div class="sourcecode">
                    <p class="source-link">
                        Source: <a href="javascript:toggleSource('M000051_source')" id="l_M000051_source">show</a>
                        
                    </p>
                    <div id="M000051_source" class="dyn-source">
                        <pre><span class="ruby-comment cmt"># File lib/adwords4r/services.rb, line 156</span>
    <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get_latest_version</span>
      <span class="ruby-ivar">@@services</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">select</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">service</span><span class="ruby-operator">|</span> <span class="ruby-identifier">service</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Integer</span> }.<span class="ruby-identifier">max</span>
    <span class="ruby-keyword kw">end</span></pre>
                    </div>
                </div>
                
            </div>
            
            <div class="method">
                <div class="title" id="M000070">
                    
                    <a name="M000070"></a><b>get_module_name</b>(version, service)
                    
                </div>
                
                <div class="description">
                  <p>
Returns the full module name for a given service
</p>
<p>
Args:
</p>
<ul>
<li>version: the <a href="API.html">API</a> version (as an integer)

</li>
<li>service: the service name (as a string)

</li>
</ul>
<p>
Returns: The full module name for the given service (as a string)
</p>

                </div>
                
                
                
                
                <div class="sourcecode">
                    <p class="source-link">
                        Source: <a href="javascript:toggleSource('M000070_source')" id="l_M000070_source">show</a>
                        
                    </p>
                    <div id="M000070_source" class="dyn-source">
                        <pre><span class="ruby-comment cmt"># File lib/adwords4r/services.rb, line 320</span>
    <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get_module_name</span>(<span class="ruby-identifier">version</span>, <span class="ruby-identifier">service</span>)
      <span class="ruby-keyword kw">return</span> <span class="ruby-node">&quot;AdWords::V#{version.to_s}::#{service}Service&quot;</span>
    <span class="ruby-keyword kw">end</span></pre>
                    </div>
                </div>
                
            </div>
            
            <div class="method">
                <div class="title" id="M000073">
                    
                    <a name="M000073"></a><b>get_namespace_v2009</b>(driver)
                    
                </div>
                
                <div class="description">
                  <p>
Returns the namespace for a version and service
</p>
<p>
Args:
</p>
<ul>
<li>driver: the service driver

</li>
</ul>
<p>
Returns: String with the namespace
</p>

                </div>
                
                
                
                
                <div class="sourcecode">
                    <p class="source-link">
                        Source: <a href="javascript:toggleSource('M000073_source')" id="l_M000073_source">show</a>
                        
                    </p>
                    <div id="M000073_source" class="dyn-source">
                        <pre><span class="ruby-comment cmt"># File lib/adwords4r/services.rb, line 362</span>
    <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get_namespace_v2009</span>(<span class="ruby-identifier">driver</span>)
      <span class="ruby-comment cmt"># This is a huge hack to get the correct namespace for a given service,</span>
      <span class="ruby-comment cmt"># but short from configuring it ourselves there seems to be no other</span>
      <span class="ruby-comment cmt"># option. This accesses one of the fields in the description of the</span>
      <span class="ruby-comment cmt"># service's methods, which indicates the namespace.</span>
      <span class="ruby-comment cmt"># Thankfully, since it's a constant and checked as part of our unit tests,</span>
      <span class="ruby-comment cmt"># it should always work.</span>
      <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">driver</span>.<span class="ruby-identifier">class</span><span class="ruby-operator">::</span><span class="ruby-constant">Methods</span>[<span class="ruby-value">0</span>][<span class="ruby-value">2</span>][<span class="ruby-value">0</span>][<span class="ruby-value">2</span>][<span class="ruby-value">1</span>]
    <span class="ruby-keyword kw">end</span></pre>
                    </div>
                </div>
                
            </div>
            
            <div class="method">
                <div class="title" id="M000063">
                    
                    <a name="M000063"></a><b>get_report_download_url</b>(environment, version)
                    
                </div>
                
                <div class="description">
                  <p>
Get the download URL for reports.
</p>
<p>
Args:
</p>
<ul>
<li>environment: the service environment to be used (as a string)

</li>
<li>version: the <a href="API.html">API</a> version (as an integer)

</li>
</ul>
<p>
Returns: The endpoint URL (as a string)
</p>

                </div>
                
                
                
                
                <div class="sourcecode">
                    <p class="source-link">
                        Source: <a href="javascript:toggleSource('M000063_source')" id="l_M000063_source">show</a>
                        
                    </p>
                    <div id="M000063_source" class="dyn-source">
                        <pre><span class="ruby-comment cmt"># File lib/adwords4r/services.rb, line 247</span>
    <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get_report_download_url</span>(<span class="ruby-identifier">environment</span>, <span class="ruby-identifier">version</span>)
      <span class="ruby-identifier">base</span> = <span class="ruby-ivar">@@environments</span>[<span class="ruby-identifier">environment</span>][<span class="ruby-identifier">version</span>]
      <span class="ruby-identifier">path</span> = <span class="ruby-value str">'reportdownload'</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">version</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-value">201003</span>
      <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">base</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">base</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">path</span>
      <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
    <span class="ruby-keyword kw">end</span></pre>
                    </div>
                </div>
                
            </div>
            
            <div class="method">
                <div class="title" id="M000058">
                    
                    <a name="M000058"></a><b>get_services</b>(version)
                    
                </div>
                
                <div class="description">
                  <p>
Get the list of service names for a given version
</p>
<p>
Args:
</p>
<ul>
<li>version: the <a href="API.html">API</a> version (as an integer)

</li>
</ul>
<p>
Returns: List of names of services (as strings) available for given version
</p>

                </div>
                
                
                
                
                <div class="sourcecode">
                    <p class="source-link">
                        Source: <a href="javascript:toggleSource('M000058_source')" id="l_M000058_source">show</a>
                        
                    </p>
                    <div id="M000058_source" class="dyn-source">
                        <pre><span class="ruby-comment cmt"># File lib/adwords4r/services.rb, line 199</span>
    <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get_services</span>(<span class="ruby-identifier">version</span>)
      <span class="ruby-ivar">@@services</span>[<span class="ruby-identifier">version</span>]
    <span class="ruby-keyword kw">end</span></pre>
                    </div>
                </div>
                
            </div>
            
            <div class="method">
                <div class="title" id="M000064">
                    
                    <a name="M000064"></a><b>get_subdir</b>(version, service)
                    
                </div>
                
                <div class="description">
                  <p>
Get the subdirectory for a service, for a given <a href="API.html">API</a>
version.
</p>
<p>
Args:
</p>
<ul>
<li>version: the <a href="API.html">API</a> version (as an integer)

</li>
<li>service: the name of the <a href="API.html">API</a> service (as a string)

</li>
</ul>
<p>
Returns: The endpoint URL (as a string)
</p>

                </div>
                
                
                
                
                <div class="sourcecode">
                    <p class="source-link">
                        Source: <a href="javascript:toggleSource('M000064_source')" id="l_M000064_source">show</a>
                        
                    </p>
                    <div id="M000064_source" class="dyn-source">
                        <pre><span class="ruby-comment cmt"># File lib/adwords4r/services.rb, line 263</span>
    <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get_subdir</span>(<span class="ruby-identifier">version</span>, <span class="ruby-identifier">service</span>)
      <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@@subdirs</span>[[<span class="ruby-identifier">version</span>, <span class="ruby-identifier">service</span>]]
    <span class="ruby-keyword kw">end</span></pre>
                    </div>
                </div>
                
            </div>
            
            <div class="method">
                <div class="title" id="M000050">
                    
                    <a name="M000050"></a><b>get_versions</b>()
                    
                </div>
                
                <div class="description">
                  <p>
Get the available <a href="API.html">API</a> versions.
</p>
<p>
Returns: List of versions available (as integers)
</p>

                </div>
                
                
                
                
                <div class="sourcecode">
                    <p class="source-link">
                        Source: <a href="javascript:toggleSource('M000050_source')" id="l_M000050_source">show</a>
                        
                    </p>
                    <div id="M000050_source" class="dyn-source">
                        <pre><span class="ruby-comment cmt"># File lib/adwords4r/services.rb, line 147</span>
    <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get_versions</span>
      <span class="ruby-ivar">@@services</span>.<span class="ruby-identifier">keys</span>
    <span class="ruby-keyword kw">end</span></pre>
                    </div>
                </div>
                
            </div>
            
            <div class="method">
                <div class="title" id="M000072">
                    
                    <a name="M000072"></a><b>get_wrapper_name</b>(version, service)
                    
                </div>
                
                <div class="description">
                  <p>
Returns the full wrapper class name for a given service
</p>
<p>
Args:
</p>
<ul>
<li>version: the <a href="API.html">API</a> version (as an integer)

</li>
<li>service: the service name (as a string)

</li>
</ul>
<p>
Returns: The full wrapper class name for the given service (as a string)
</p>

                </div>
                
                
                
                
                <div class="sourcecode">
                    <p class="source-link">
                        Source: <a href="javascript:toggleSource('M000072_source')" id="l_M000072_source">show</a>
                        
                    </p>
                    <div id="M000072_source" class="dyn-source">
                        <pre><span class="ruby-comment cmt"># File lib/adwords4r/services.rb, line 351</span>
    <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get_wrapper_name</span>(<span class="ruby-identifier">version</span>, <span class="ruby-identifier">service</span>)
      <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">get_module_name</span>(<span class="ruby-identifier">version</span>, <span class="ruby-identifier">service</span>) <span class="ruby-operator">+</span> <span class="ruby-node">&quot;::#{service}ServiceWrapper&quot;</span>
    <span class="ruby-keyword kw">end</span></pre>
                    </div>
                </div>
                
            </div>
            
            <div class="method">
                <div class="title" id="M000074">
                    
                    <a name="M000074"></a><b>validate_param</b>(param_name, param, type)
                    
                </div>
                
                <div class="description">
                  <p>
Validates whether a parameter is of the correct type This method is invoked
by the wrappers during runtime to check the validity of every parameter.
</p>
<p>
Args:
</p>
<ul>
<li>param_name: the parameter name (as a String)

</li>
<li>param: the parameter value

</li>
<li>type: the expected type (the class object itself)

</li>
</ul>
<p>
Returns: nil, upon success
</p>
<p>
Raises:
</p>
<ul>
<li>ArgumentError: in case of an unexpected type

</li>
</ul>

                </div>
                
                
                
                
                <div class="sourcecode">
                    <p class="source-link">
                        Source: <a href="javascript:toggleSource('M000074_source')" id="l_M000074_source">show</a>
                        
                    </p>
                    <div id="M000074_source" class="dyn-source">
                        <pre><span class="ruby-comment cmt"># File lib/adwords4r/services.rb, line 387</span>
    <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">validate_param</span>(<span class="ruby-identifier">param_name</span>, <span class="ruby-identifier">param</span>, <span class="ruby-identifier">type</span>)
      <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">param</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-identifier">type</span>

      <span class="ruby-keyword kw">begin</span>
        <span class="ruby-identifier">type</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">param</span>)
      <span class="ruby-keyword kw">rescue</span>
        <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;Parameter '#{param_name}'&quot;</span> <span class="ruby-operator">+</span>
            <span class="ruby-node">&quot; should be convertible into type #{type.to_s}&quot;</span>
      <span class="ruby-keyword kw">end</span>
      <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
    <span class="ruby-keyword kw">end</span></pre>
                    </div>
                </div>
                
            </div>
            
            <div class="method">
                <div class="title" id="M000055">
                    
                    <a name="M000055"></a><b>version_has_service</b>(version, service)
                    
                </div>
                
                <div class="description">
                  <p>
Does the given version exist and contain the given service?
</p>
<p>
Returns: Boolean indicating whether the given version exists and contains
the given service
</p>

                </div>
                
                
                
                
                <div class="sourcecode">
                    <p class="source-link">
                        Source: <a href="javascript:toggleSource('M000055_source')" id="l_M000055_source">show</a>
                        
                    </p>
                    <div id="M000055_source" class="dyn-source">
                        <pre><span class="ruby-comment cmt"># File lib/adwords4r/services.rb, line 177</span>
    <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">version_has_service</span>(<span class="ruby-identifier">version</span>, <span class="ruby-identifier">service</span>)
      <span class="ruby-keyword kw">return</span> (<span class="ruby-operator">!</span><span class="ruby-ivar">@@services</span>[<span class="ruby-identifier">version</span>].<span class="ruby-identifier">nil?</span> <span class="ruby-keyword kw">and</span>
              <span class="ruby-ivar">@@services</span>[<span class="ruby-identifier">version</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">service</span>))
    <span class="ruby-keyword kw">end</span></pre>
                    </div>
                </div>
                
            </div>
            
</div>
    </div>
  </body>
</html>    